package com.junjie.checkin.entity.Enum;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author 洪浚杰
 * @description 活动历史记录状态枚举
 * @date 2025/6/19 10:50
 */
@Getter
public enum ActivityHistoryStatusEnum implements StringValuedEnum{
    NO_SIGN_UP("noSignIn", 0),
    SIGN_UP("signIn", 1),
    REGISTERED("registered", 2),
    CANCELLED("cancelled",3);
    private final String value;
    private final Integer  index;
    @JsonCreator
    public static ActivityHistoryStatusEnum fromValue(String value) {
        return Arrays.stream(values())
                .filter(e -> e.getValue().equalsIgnoreCase(value))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Invalid value: " + value));
    }

    private ActivityHistoryStatusEnum(String value, Integer index) {
        this.value = value;
        this.index = index;
    }
}
